﻿
namespace SRTSolutions.Elevate.Guide
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using NUnit.Framework;
    [TestFixture]
    public class KeyedCollection
    {
        class Thing { public string Name; public string Description;}
        [Test]
        public void TurnAListIntoADictionary()
        {
            var coll = new KeyedCollection2<string,Thing>(i => i.Name);
            coll.Add(new Thing { Name = "foo", Description = "bar" });
            coll.Add(new Thing { Name = "baz", Description = "bat" });
            Assert.AreEqual("bar", coll["foo"].Description);
            Assert.AreEqual("bat", coll["baz"].Description);
        }

    }
}